First of all, thanks for this community, although recently discovered by me it helped me many times just by reading some of your posts every once in a while.
I've decided to join you now, not only to leech your wisdom but in the future to try and provide some, sadly, this is not the case today.

Today at college it was proposed for us to make a C program for a distribution company.
That company owns a warehouse where its products are stored, that warehouse its made of X corridors with Y closets, for the sake of this explanation lets assume 3 corridors each with 3 closets.
In each closet theres the stock that the warehouse sells, each item of that stock its stored in a unique location (corridor and closet).
It is also available to us a binary file organised this way:

3 3
3 10 3 20 2 30 3
2 12 5 15 4
1 9 7
...

The first line of that file has 2 integers, one for the number of corridors the other for the closets.

Second line, first digit indicates that there is 3 items stored in the closet 1 corridor 1, the product with the id "10" has 3 units, the product with the id "20" has 2, and the product with the id "30" has 3 units.

Third line same thing but for closet 2, first digit indicates that there is 2 items stored in the closet 2 corridor 1, 5 units of "12" and 4 of "15"

Fourth line has 1 item on closet 3 corridor 1, 7 units of "9".

The next line would be for closet 1 but now in corridor 2.

But my problem here it's not coding itself, its logic.

I want to read from that binary file and allocate all that info logically structured into memory so I can later manipulate it for like listing available stock, restocking, etc.. .

I know I'll have to use dynamic structures, the number of closets and corridors won't change while the program is executing but the quantity and variety of products in each closet will.

What would be your approach?

Thank you.